package com.happyelements.display
{
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	/**
	 *
	 * @author Steven
	 *
	 */
	public final class HEStage extends HEDisplayObjectContainer
	{
		private var _rect:Rectangle;
		
		public function HEStage(stageWidth:Number = 0, stageHeight:Number = 0)
		{
			this._rect = new Rectangle(0, 0, stageWidth, stageHeight);
		}
		
		override public function globalToLocal(point:Point):Point
		{
			return point.clone();
		}
		
		override public function localToGlobal(point:Point):Point
		{
			return point.clone();
		}
		
		override public function getRect(targetCoordinateSpace:HEDisplayObject = null):Rectangle
		{
			var rect:Rectangle = _rect.clone();
			
			if (targetCoordinateSpace)
			{
				var target:Point = targetCoordinateSpace.globalToLocal(rect.topLeft);
				
				rect.x = target.x;
				rect.y = target.y;
			}
			
			return rect;
		}
		
		public function get stageWidth():Number
		{
			return _rect.width;
		}
		
		public function set stageWidth(value:Number):void
		{
			_rect.width = value;
		}
		
		public function get stageHeight():Number
		{
			return _rect.height;
		}
		
		public function set stageHeight(value:Number):void
		{
			_rect.height = value;
		}
	}
}